package com.itheima.mapper;

import com.itheima.domain.Role;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName:RoleMapper
 * Package:com.itheima.mapper
 * Description:
 * Date:2021/11/6 0:00
 * Author:liu.min
 */
public interface RoleMapper {
//    private Long id;
//    private String roleName;
//    private String roleDesc;
    @Select("select * from sys_role")
    List<Role> findAll();

    @Select("insert into sys_role values(#{id},#{roleName},#{roleDesc})")
    void save(Role role);

    @Select("select * from sys_user_role ur,sys_role r where ur.roleId=r.id and ur.userId=#{id}")
    List<Role> findRoleByUserId(Long id);
}
